import java.util.Scanner;
import java.util.Random;
public class shitojiandaobu {
            public static int  getGesture(){
                System.out.println("石头，剪刀，布 ！");
                System.out.println("1.石头 2.剪刀 3.布 ，其余数字退出游戏");
                Scanner scan = new Scanner(System.in);
                int input = scan.nextInt();
                if(input>3 || input <1){
                    return 0;
                }
                return input;
            }

            public static void guessGame() {
                int sumVic = 0;//胜局计数
                int sumLos = 0;//败局计数
                int sumPj = 0;//平局计数
                while (true) {
                    int num = getGesture();
                    Random rand = new Random();
                    int inputIc = rand.nextInt(3) + 1;
                    if (num == 0) {//无效值
                        System.out.println("已退出游戏");
                        return;
                    }

                    if (num == inputIc) {//平局
                        System.out.print("平局！");
                        sumPj ++;
                        switch (num) {
                            case 1:
                                System.out.println("您和电脑出的都是石头！");
                                break;
                            case 2:
                                System.out.println("您和电脑出的都是剪刀！");
                                break;
                            case 3:
                                System.out.println("您和电脑出的都是布！");
                                break;
                        }
                    }

                    if ((inputIc == 1 && num == 3) || (inputIc == 2 && num == 1) || (inputIc == 3 && num == 2)) {//玩家获胜
                        System.out.print("恭喜您获胜！");
                        sumVic ++;
                        switch (num) {
                            case 1:
                                System.out.println("您出的是石头,电脑出的是剪刀！");
                                break;
                            case 2:
                                System.out.println("您出的是剪刀,电脑出的是布！");
                                break;
                            case 3:
                                System.out.println("您出的是布,电脑出的是石头！");
                                break;
                        }
                    }

                    if ((inputIc == 3 && num == 1) || (inputIc == 2 && num == 3) || (inputIc == 1 && num == 2)) {
                        System.out.print("很遗憾，您输了！");
                        sumLos ++;
                        switch (num) {
                            case 1:
                                System.out.println("您出的是石头,电脑出的是布！");
                                break;
                            case 2:
                                System.out.println("您出的是剪刀,电脑出的是石头！");
                                break;
                            case 3:
                                System.out.println("您出的是布,电脑出的是剪刀！");
                                break;
                        }
                    }
                    System.out.println("您已经获胜"+sumVic+"局，失败"+sumLos+"局，打平"+sumPj+"局");
                    System.out.println("\n");
                }
            }
}
